export const PUBLIC_KEY = 'publicKey'

export enum ThemeMode {
  Day = 'day',
  Dark = 'dark'
}

export enum Status {
  // 成功
  SUCCESS = 200,
  // 未授权
  NO_AUTH = 403,
  // 失败
  PARAMS_ERROR = 500,
  FAIL,
  /**  token异常需要重新登录的情况 **/
  NOT_TOKEN = 600, // 未能从请求中读取token
  INVALID_TOKEN = 601, // token无效
  TOKEN_TIMEOUT = 602, // token过期
  BE_REPLACED = 603, // token被顶下线
  KICK_OUT = 604, // token已被踢下线
  TOKEN_ERROR = 605 //token异常
}

// 需要重新登录的状态
export const ReLoginStatus = [
  Status.NOT_TOKEN,
  Status.INVALID_TOKEN,
  Status.TOKEN_TIMEOUT,
  Status.BE_REPLACED,
  Status.KICK_OUT,
  Status.TOKEN_ERROR
]

// 本地存储数据的常量名
export enum CacheType {
  TOKEN = 'token',
  LOGIN_STATUS = 'loginStatus',
  USER_INFO = 'userInfo',
  MENU_CODE_LIST = 'menuCodeList',
  MENU_LIST = 'menuList',
  ROUTES = 'routes',
  THEME_CONFIG = 'themeConfig'
}

export enum VerifyType {
  Phone = 1,
  Email = 2
}

// export const THEME_CONFIG = 'themeConfig'

// 操作描述
export enum ActionDesc {
  UpdatePassword = '修改密码',
  SecondAuth = '二级认证',
  Add = '新增',
  Edit = '修改',
  Delete = '删除',
  BatchDelete = '批量删除',
  UserSearch = '用户查询',
  UserResetPwd = '用户重置密码',
  UserKickOut = '用户下线',
  UserBanned = '用户封禁',
  UserBatchBanned = '用户批量封禁',
  UserBatchUniteDisable = '用户批量解封',
  UserAssignRole = '用户分配角色',
  RoleSearch = '角色查询',
  RoleAssignPermission = '角色分配权限',
  BannedSearch = '封禁查询',
  LoginLogSearch = '登录日志查询',
  OperationLogSearch = '操作日志查询',
  OperationLogDetail = '查看请求详情',
  LexiconSearch = '敏感词查询',
  CustomRuleSearch = '自定义规则查询',
  QuestionSearch = '题库列表查询',
  QuestionDetail = '查看题目详情',
  ActivitySearch = '活动列表查询',
  IntegralConsumeSearch = '积分消费列表查询',
  IntegralObtainSearch = '积分获取列表查询',
  IntegralShopSearch = '积分商城列表查询',
  ContinueRewardSearch = '连续签到列表查询'
}

export enum RoutesPath {
  DashBoard = '/main/dashboard',
  System = '/main/system',
  UserList = '/main/system/userList',
  RoleList = '/main/system/roleList',
  MenuList = '/main/system/menuList',
  Banned = '/main/system/banned',
  SystemLog = '/main/system/log',
  LoginList = '/main/system/log/login',
  OperationList = '/main/system/log/operation',
  SystemSensitive = '/main/system/sensitive',
  UpdateConfig = '/main/system/sensitive/config',
  Lexicon = '/main/system/sensitive/lexicon',
  CustomRule = '/main/system/sensitive/customRule',
  AddressList = '/main/system/addressList',
  Classify = '/main/classify',
  ClassifyQuestion = '/main/classify/question',
  QuestionDir = '/main/question',
  QuestionList = '/main/question/questionList',
  QuestionInfo = '/main/question/questionInfo',
  Activity = '/main/activity',
  ActivityList = '/main/activity/activityList',
  Integral = '/main/integral',
  IntegralDetail = '/main/integral/userDetailIntegral',
  IntegralTask = '/main/integral/integralTask',
  IntegralShop = '/main/integral/integralShop',
  IntegralConvert = '/main/integral/integralConvert',
  Sign = '/main/sign',
  SignContinuousReward = '/main/sign/continuousReward',
  SignDailyAttendance = '/main/sign/dailyAttendance'
}

// 用于Table表格配置
export enum PagesKey {
  UserList = 'user',
  RoleList = 'role',
  Banned = 'user/banned',
  LoginLog = 'log/login',
  OperationLog = 'log/operation',
  MenuList = 'menu',
  SensitiveLexIcon = 'sensitive/lexicon',
  SensitiveReplace = 'sensitive/replace',
  ClassifyQuestion = 'classify/question',
  QuestionList = 'questionInfo',
  ActivityList = 'activity',
  IntegralConsume = 'integral/detail/consume',
  IntegralObtain = 'integral/detail/obtain',
  IntegralTask = 'integral/task',
  IntegralShop = 'integral/shop',
  IntegralConvert = 'integral/convert',
  SignContinuousReward = 'continue/award'
}

export const phoneReg = /^1[3456789]\d{9}$/
export const emailReg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/

// 用于js-cookie
export const IS_NEED_SECOND_AUTH = 'isNeedSecondAuth'
